home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13893 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.4 KB

  1. Path: news.ge.com!news
  2. From: steve bridges <sbridges@OASIS.GE.COM>
  3. Newsgroups: comp.os.ms-windows.programmer.controls,comp.lang.c,comp.lang.basic.visual.misc
  4. Subject: Re: VBX instances - HCTL values
  5. Date: Wed, 10 Apr 96 15:01:11 PDT
  6. Organization: General Electric Company
  7. Message-ID: <NEWTNews.829173996.8168.sbridges@OASIS.GE.COM>
  8. References: <4iv5pk$j2q@news.its.com> <4j5p85$qv9@zebedee.ingres.co.uk>  <4jp844$8jn@news.its.com>
  9. NNTP-Posting-Host: 158.254.10.83
  10. Mime-Version: 1.0
  11. Content-Type: TEXT/PLAIN; charset=US-ASCII
  12. X-Newsreader: NEWTNews & Chameleon -- TCP/IP for MS Windows from NetManage
  13.  
  14.  
  15. In Article<4jp844$8jn@news.its.com>, <mastbrook@duff.com> writes:
  16.  
  17. > > mastbrook@duff.com (Bill Mastbrook) wrote:
  18. > >>Each instance of a VBX that I've created seems to be generating the
  19. > >>same value for HCTL.
  20. > jonm@ingres.com (Jon Machtynger) wrote:
  21. > >To convince you that it should all work.  Take a look at the circ2
  22. > >or circ3 examples that come with VB3.0 Proffessional edition.
  23. > >In the FireClickIn reoutine, add the following code.
  24. > >char Msg[100];
  25. > >wsprintf(Msg, "HTCL = %d", hctl);
  26. > >MessageBox(NULL, Msg, NULL, MB_OK);
  27. > >Now creae two circ2 controls.  When you click on each one, it
  28. > >should show a different value.
  29. > I did exactly this and the same problem still exists: The HCTL value
  30. > returned from clicking in any instance of the circ2.vbx is 242.  This
  31. > is exactly the same value for hctl that I always see from any VBX
  32. > (242).
  33. > Here's exactly what I did ...
  34. > Added the above code to the beginning of FireClickIn in circ2.c.
  35. > Made a new VBX project using VC++ 1.52.
  36. > Added files circ2.c, circ2.def, circ2.rc to the project.
  37. > Added vbapi to the list of linked libraries.
  38. > Built the VBX.
  39. > Created a new VB 3.0 exe containing one form with the circ2.vbx on it.
  40. > (No code, whatsoever).
  41. > Copied the VBX to my system directory.
  42. > Ran multiple instances of this exe.
  43. > All clicks generated "HCTL = 242".
  44.  
  45. The problem here is that an HCTL is actually a far pointer. you should
  46. try :
  47.     sprintf(Msg,"Hctl = %p", (long) hctl);
  48.  
  49. and include stdio.h
  50.  
  51. all you are currently display id the offset to the HCTL which will always be 
  52. the same.
  53. I think your problem would be resolved by using the cbCtlExtra portion of the 
  54. MODEL definition and the VBDerefControl API.
  55.  
  56.  
  57. > I did receive the following warnings when buildiing the VBX:
  58. >     Binding resources...
  59. >     RC: warning RW4002: Non-discardable segment 1 set to PRELOAD
  60. >     RC: warning RW4002: Non-discardable segment 2 set to PRELOAD
  61. > I ignored them.
  62. > Any ideas?  Could this possibly be a problem with my machine, my
  63. > compiler, my compile setttings, or something similar, because from
  64. > this test using circ2.vbx I would tend to think that there isn't
  65. > anything wrong with my code.
  66.  
  67. This warning is just to tell you that certain segments of your code,
  68. The one containing the entry point for instance, are going to be loaded.
  69.  
  70.  
  71. > I just realized that when you said, "Now creae two circ2 controls",
  72. > that you may have meant to create two different .vbx files using the
  73. > same code.  Is this correct?  If so, does this mean that any instance
  74. > of a particular VBX (i.e. .vbx file included in a VB project and the
  75. > vbx control placed on a form) passes the same HCTL value to the main
  76. > procedure of the VBX.  If this is true, then I'm back to my original
  77. > question, "How do you fire events in the correct one?".
  78. > Thanks,
  79. > Bill
  80.  
  81.  
  82.